package com.video.netty.send;

import com.video.commons.sendaop.ISocketSend;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 57.设置一键对讲主机
 * {"id":"talkhost", "terminal":"16"}
 * 返回
 * {"id":"talkhostResponse","response":"success"}
 * {"id":"talkhostResponse","response":"fail"}
 *
 * @version 1.0
 * @user ken
 * @date 2019/7/30 17:28
 */
@Component
public class TalkhostSend extends ISocketSend {

    @Override
    public Map<String, Object> sendMsg(Object... objs) {
        Integer cid = (Integer) objs[0];
        Integer[] uids = (Integer[]) objs[1];

        List<String> list = new ArrayList<>();
        for (Integer uid : uids) {
            list.add(uid + "");
        }

        Map<String, Object> map = new HashMap<>();
        map.put("id", "talkhost");
        map.put("terminal", cid + "");
        map.put("users", list);
        return map;
    }

}
